////
////  UIViewController+BarButtonItem.m
////  Local
////
////  Created by 刘铎 on 13-12-6.
////  Copyright (c) 2013年 上海即略网络信息科技有限公司. All rights reserved.
////
//
//#import "UIViewController+Helper.h"
//#import "Common.h"
//#import "UIView+Helper.h"
//static const NSInteger TITLE_LABEL = 21;
//static const NSInteger SUBTITLE_LABEL = 22;
//
//@implementation UIViewController (Helper)
//
//- (void)setTitle:(NSString *)title {
//    if (!self.navigationItem.titleView) {
//        self.navigationItem.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ViewWidth, 44)];
//        self.navigationItem.titleView.backgroundColor = BenSe_COLOR;
//    }
//    
//    UILabel *label = [self titleLabel];
//    label.font = [UIFont boldSystemFontOfSize:18];
//    label.textColor = [UIColor whiteColor];
//    label.text = title;
//}
//
//- (void)setSubtitle:(NSString *)title {
//    BOOL iOS6Style = IOS_VERSION < 7.0 && ([self titleLabel].text.length == 0);
//    
//    if (!self.navigationItem.titleView) {
//        self.navigationItem.titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, iOS6Style ? 100 : ViewWidth, 44)];
//        self.navigationItem.titleView.backgroundColor = [UIColor clearColor];
//    }
//    
//    UILabel *label = [self subtitleLabel];
//    label.text = title;
//    
//    if (iOS6Style) {
//        label.center = CGPointMake(self.navigationItem.titleView.midX, self.navigationItem.titleView.midY);
//        label.font = [UIFont boldSystemFontOfSize:19];
//        label.textAlignment = UITextAlignmentCenter;
//    }
//}
//
//- (void)setRightBarButtonItemWithImage:(UIImage *)image target:(id)target action:(SEL)action {
//    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:target action:action];
//    self.navigationItem.rightBarButtonItem = item;
//}
//
//#pragma mark - Private Methods
//
//- (UILabel *)titleLabel {
//    UILabel *label = (UILabel *)[self.navigationItem.titleView viewWithTag:TITLE_LABEL];
//    if (!label) {
//        label = [[UILabel alloc] initWithFrame:CGRectMake(8, 0, 60, 44)];
//        label.font = [UIFont boldSystemFontOfSize:19];
//        label.textColor = [UIColor whiteColor];
//        label.backgroundColor = [UIColor clearColor];
//        [self.navigationItem.titleView addSubview:label];
//        label.tag = TITLE_LABEL;
//    }
//    return label;
//}
//
//- (UILabel *)subtitleLabel {
//    UILabel *titleLabel = [self titleLabel];
//    [titleLabel sizeToFit];
//    titleLabel.center = CGPointMake(titleLabel.center.x, 22);
//    CGFloat x = titleLabel.text.length > 0 ? titleLabel.x + titleLabel.width + 5 : 0;
//    
//    UILabel *label = (UILabel *)[self.navigationItem.titleView viewWithTag:SUBTITLE_LABEL];
//    if (!label) {
//        label = [[UILabel alloc] initWithFrame:CGRectMake(x, 1, 200, 44)];
//        label.font = [UIFont systemFontOfSize:14];
//        label.textColor = [UIColor whiteColor];
//        label.backgroundColor = [UIColor clearColor];
//        [self.navigationItem.titleView addSubview:label];
//        label.tag = SUBTITLE_LABEL;
//    }
//    return label;
//}
//
//@end
